<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/common/taglib.jsp"%>
<!DOCTYPE html>
<html>
<head>
<%@ include file="/WEB-INF/common/head.jsp"%>
</head>
<body class="${cookie.bodyClass.value}">
	<div class="container body">
		<div class="main_container">
			<%@ include file="/WEB-INF/common/left.jsp"%>
			<%@ include file="/WEB-INF/common/top.jsp"%>
			<!-- page content -->
			<div class="right_col" role="main" id="main">
				<div class="x_panel">
					<div class="x_title">
						<h2>返利明细列表</h2>
						<div class="clearfix"></div>
					</div>
					<div class="x_content">
						<form role="form" id="searchForm">
							<input class="form-control input-sm"  type="hidden" name="map['memberId']" value="${memberId}" >
							<div class="container">
								<div class="row">
									<div class="col-lg-3">
										<div class="clearfix col-sm-6" style="float: left;">
											<input class="form-control input-sm" name="map['startDate']" readonly="readonly" type="text" 
										onClick="WdatePicker({dateFmt:'yyyy-MM-dd'})" placeholder="开始时间" />
										</div>
										至
										<div class="clearfix col-sm-6"   style="float: left;">
											<input class="form-control input-sm" name="map['endDate']" readonly="readonly" type="text" 
										onClick="WdatePicker({dateFmt:'yyyy-MM-dd'})" placeholder="结束时间" />
										</div>
									</div>
									<div class="col-lg-3">
										<button type="button" class="btn btn-primary btn-sm" onclick="search();">搜索</button>
										<c:if test="${not empty memberId}">
										<button type="button" class="btn btn-dark btn-sm" onclick="back();">返回</button>
										</c:if>
									</div>
								</div>
							</div>
						</form>
						<div class="table-responsive">
							<table id="pointsRebates" class="table table-bordered table-striped table-hover" 
							  cellspacing="0" width="100%">
								<thead>
									<tr class="mytableHead">
										<th class="myRowNumber"></th>
										<!-- <th>id</th> -->
										<th>用户昵称</th>
										<th>返利积分</th>
										<th>返利金积分</th>
										<th>返利银积分</th>
										<th>时间</th>
									</tr>
								</thead>
							</table>
						</div>
					</div>
				</div>
			</div>
			<!-- /page content -->
			<%@ include file="/WEB-INF/common/foot.jsp"%>
		</div>
	</div>
	<%@ include file="/WEB-INF/common/script.jsp"%>
	<script>
	$(function(){
		var t = $("#pointsRebates").DataTable({
		    ajax: {
		        url: ctx+'admin/pointsRebate/findPointsRebates',
		        type: 'POST',
		        data: function(d){$.extend(d,serializeObject($("#searchForm")));}
		    },
		    columns: [
		        { "data":null,"render":rowNumberRender},
		        { "data":'nickName'},
		        { "data":'rebatePoints'},
		        { "data":'goldPoints'},
		        { "data":'silverPoints'},
		        { "data":'createDate'},
		    ]
		    
		});
		$("#searchForm input").keydown(function(event){
			if(event.keyCode == 13){
				search();
			}
		});
		$("#searchForm select").change(search);
	});
	function rowNumberRender(data, type, row, meta) {
	    var setting = meta.settings;
	    var rowNumber = setting._iDisplayStart + (meta.row + 1);
		return rowNumber;
  	}
	function search(){
		$('#pointsRebates').DataTable().ajax.reload(function(d){$.extend(d,serializeObject($("#searchForm")));}, true);
	}
	function back() {
        window.location = ctx + "admin/member/toMemberPage";
    }
	</script>
</body>
</html>